Get Value of Color Sensor

  • Function:

    magicbox.get_color_value(port, index)
    
  • Description: get data of color sensor

  • Required parameter:

    • port: controller port, range: 1~6
    • index: color index. 0: red; 1: green; 2: blue
  • Return:
    • value: value of color sensor
  • Example

    res = magicbox.get_color_value(port=1, index=1)
    print(res)
    

    Get the green value of color sensor connected to Port 1 of controller.

results matching ""

    No results matching ""